package com.example.springannotation.controller;

import org.springframework.web.bind.annotation.*;

@RequestMapping("/user")
@RestController
public class UserController {

    @RequestMapping("/login/{id}/{name}")
    public String login1(@PathVariable Integer id, @PathVariable("name") String userName) {
        return "接收到id: " + id + " 接收到name: " + userName;
    }

    @GetMapping("/test")
    public String test() {
        int a = 1 / 0;
        return "test";
    }
    @GetMapping("/login")
    public String login(String name, String password) {
        return "登录成功";
    }


//    @RequestMapping("/login")
//    public String login(@RequestParam(value = "name", required = false) String userName) {
//        return "接收到用户名: " + userName;
//    }

/*
    @RequestMapping(value = "/login")
    public String login(String name, String password) {
        return "接收到用户名: " + name + " 接收到密码: " + password;
    }
*/

}
